from django.db import models
from .api_keys import ApiKeys


# Create your models here.
class ChatModel(models.Model):
    """
    ChatModel
    """
    id = models.BigAutoField(primary_key=True)
    platform = models.CharField(verbose_name="平台名称", max_length=32, blank=False, null=False)
    name = models.CharField(verbose_name="模型名称", max_length=32, blank=False, null=False)
    value = models.CharField(verbose_name="模型值", max_length=256, blank=False, null=False)
    sort_num = models.IntegerField(verbose_name="排序", null=True, blank=True, default=None)
    enabled = models.BooleanField(verbose_name="当前状态", default=True)
    power = models.IntegerField(verbose_name="消耗算力", null=True, blank=True, default=1)
    open = models.BooleanField(verbose_name="开放状态", default=True)
    max_tokens = models.IntegerField(verbose_name="最大相应长度", null=True, blank=True, default=2048)
    max_context = models.IntegerField(verbose_name="最大上下文长度", null=True, blank=True, default=8092)
    temperature = models.FloatField(verbose_name="创意度", null=True, blank=True, default=1)
    key_id = models.ForeignKey(verbose_name="apikey id", to="ApiKeys", on_delete=models.SET_NULL, default=None, null=True, blank=True)

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

